<?php
class ControllerCommunitySuccess extends Controller {
    public function index() {
        $this->language->load('community/success');

        switch($this->session->data['success_type']){
            case 'post_waiting_approval':
                $this->document->setTitle($this->language->get('post_waiting_approval_heading_title'));
                $this->data['heading_title'] = $this->language->get('post_waiting_approval_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_post_waiting_approval_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'topic':
                $this->document->setTitle($this->language->get('topic_heading_title'));
                $this->data['heading_title'] = $this->language->get('topic_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_topic_message'), $this->session->data['topic_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['topic_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['topic_link']);
                break;
            case 'vote':
                $this->document->setTitle($this->language->get('vote_heading_title'));
                $this->data['heading_title'] = $this->language->get('vote_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_vote_message'), $this->session->data['topic_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['topic_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['topic_link']);
                break;
            case 'reply':
                $this->document->setTitle($this->language->get('reply_heading_title'));
                $this->data['heading_title'] = $this->language->get('reply_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_reply_message'), $this->session->data['reply_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['reply_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['reply_link']);
                break;
            case 'edit':
                $this->document->setTitle($this->language->get('edit_heading_title'));
                $this->data['heading_title'] = $this->language->get('edit_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_edit_message'), $this->session->data['edit_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['edit_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['edit_link']);
                break;
            case 'post_del':
                $this->document->setTitle($this->language->get('post_del_heading_title'));
                $this->data['heading_title'] = $this->language->get('post_del_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_post_del_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'draft':
                $this->document->setTitle($this->language->get('draft_heading_title'));
                $this->data['heading_title'] = $this->language->get('draft_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_draft_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'pm_sent':
                $this->document->setTitle($this->language->get('pm_sent_heading_title'));
                $this->data['heading_title'] = $this->language->get('pm_sent_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_pm_sent_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'pm_del':
                $this->document->setTitle($this->language->get('message_del_heading_title'));
                $this->data['heading_title'] = $this->language->get('message_del_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_message_del_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'draft_del':
                $this->document->setTitle($this->language->get('draft_del_heading_title'));
                $this->data['heading_title'] = $this->language->get('draft_del_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_draft_del_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'profile_update':
                $this->document->setTitle($this->language->get('profile_update_heading_title'));
                $this->data['heading_title'] = $this->language->get('profile_update_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_profile_update_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'board_preference_update':
                $this->document->setTitle($this->language->get('board_preference_update_heading_title'));
                $this->data['heading_title'] = $this->language->get('board_preference_update_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_board_preference_update_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'subscribe_topic':
                $this->document->setTitle($this->language->get('subscribe_topic_heading_title'));
                $this->data['heading_title'] = $this->language->get('subscribe_topic_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_subscribe_topic_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'unsubscribe_topic':
                $this->document->setTitle($this->language->get('unsubscribe_topic_heading_title'));
                $this->data['heading_title'] = $this->language->get('unsubscribe_topic_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_unsubscribe_topic_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'bookmark_topic':
                $this->document->setTitle($this->language->get('bookmark_topic_heading_title'));
                $this->data['heading_title'] = $this->language->get('bookmark_topic_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_bookmark_topic_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'remove_topic_bookmark':
                $this->document->setTitle($this->language->get('remove_topic_bookmark_heading_title'));
                $this->data['heading_title'] = $this->language->get('remove_topic_bookmark_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_remove_topic_bookmark_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'subscribe_forum':
                $this->document->setTitle($this->language->get('subscribe_forum_heading_title'));
                $this->data['heading_title'] = $this->language->get('subscribe_forum_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_subscribe_forum_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'unsubscribe_forum':
                $this->document->setTitle($this->language->get('unsubscribe_forum_heading_title'));
                $this->data['heading_title'] = $this->language->get('unsubscribe_forum_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_unsubscribe_forum_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'unsubscription':
                $this->document->setTitle($this->language->get('unsubscription_heading_title'));
                $this->data['heading_title'] = $this->language->get('unsubscription_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_unsubscription_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'solve_topic':
                $this->document->setTitle($this->language->get('solve_topic_heading_title'));
                $this->data['heading_title'] = $this->language->get('solve_topic_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_solve_topic_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'unsolve_topic':
                $this->document->setTitle($this->language->get('unsolve_topic_heading_title'));
                $this->data['heading_title'] = $this->language->get('unsolve_topic_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_unsolve_topic_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'thank_post':
                $this->document->setTitle($this->language->get('thank_post_heading_title'));
                $this->data['heading_title'] = $this->language->get('thank_post_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_thank_post_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'report':
                $this->document->setTitle($this->language->get('report_heading_title'));
                $this->data['heading_title'] = $this->language->get('report_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_report_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'moderate':
                $this->document->setTitle($this->language->get('moderate_heading_title'));
                $this->data['heading_title'] = $this->language->get('moderate_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_moderate_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'moderate_report':
                $this->document->setTitle($this->language->get('moderate_report_heading_title'));
                $this->data['heading_title'] = $this->language->get('moderate_report_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_moderate_report_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'banning':
                $this->document->setTitle($this->language->get('banning_heading_title'));
                $this->data['heading_title'] = $this->language->get('banning_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_banning_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'warning':
                $this->document->setTitle($this->language->get('warning_heading_title'));
                $this->data['heading_title'] = $this->language->get('warning_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_warning_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'log':
                $this->document->setTitle($this->language->get('log_heading_title'));
                $this->data['heading_title'] = $this->language->get('log_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_log_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'update_deleted':
                $this->document->setTitle($this->language->get('update_deleted_heading_title'));
                $this->data['heading_title'] = $this->language->get('update_deleted_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_update_deleted_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['success_type']);
                unset($this->session->data['forwarded_link']);
                break;
        }

        $this->data['breadcrumbs'] = array();

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_home'),
            'href'      => $this->url->link('common/home'),
            'separator' => false
        );

        $this->data['breadcrumbs'][]=array(
            'href'      =>      $this->url->link('community/community'),
            'text'      =>      $this->language->get('text_community'),
            'separator' =>      $this->language->get('text_separator')
        );

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_success'),
            'href'      => $this->url->link('community/success'),
            'separator' => $this->language->get('text_separator')
        );

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/community/success.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/community/success.tpl';
        } else {
            $this->template = 'default/template/community/success.tpl';
        }

        $this->children = array(
            'common/column_left',
            'common/column_right',
            'common/content_top',
            'common/content_bottom',
            'common/footer',
            'common/header'
        );

        $this->response->setOutput($this->render());
    }
}
?>